home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / DockExtenders / LaunchPad / Source / IconAlign.ps < prev    next >
Text File  |  1993-12-14  |  2KB  |  83 lines

  1. %!
  2. % IconAlign.ps - a simple program to neatly arrange all screen icons at the
  3. % bottom of the screen.  Some portions ruthlessly hacked out of gravity.ps.
  4. % Disclaimer:  I make no assurances of the robustness of this code.  Use at
  5. % your own risk.
  6. % Varun Mitroo
  7. % 25 August, 1991
  8.  
  9. % numwins               - number of windows
  10. % windowlist            - array[window# of screen window]
  11. % wincoordinates        - array[coordinates of windows(x, y, width, height]
  12.  
  13. /windowlist
  14.     0 countscreenlist /numwins exch def numwins array
  15.     0 screenlist
  16.     def
  17. /wincoordinates numwins array def
  18.  
  19. /savecoordinates numwins array def
  20.  
  21. 0 1 numwins 1 sub
  22. {
  23. dup
  24. /coords 4 array def
  25. windowlist exch get currentwindowbounds
  26. coords 3 3 -1 roll put
  27. coords 2 3 -1 roll put
  28. coords 1 3 -1 roll put
  29. coords 0 3 -1 roll put
  30. savecoordinates exch coords put
  31. }for
  32.  
  33.  
  34. 0 1 numwins 1 sub
  35. {
  36. dup
  37. /coords 4 array def
  38. windowlist exch get currentwindowbounds
  39. coords 3 3 -1 roll put
  40. coords 2 3 -1 roll put
  41. coords 1 3 -1 roll put
  42. coords 0 3 -1 roll put
  43. wincoordinates exch coords put
  44. }for
  45.  
  46. /xcount 0 def
  47. /ycount 0 def
  48.  
  49. 0 1 numwins 3 sub  {
  50.         /num exch def
  51.         /cwin windowlist num get def
  52.         wincoordinates num get aload  pop /height exch def /width exch def /ypos exch def /xpos exch def
  53.  
  54.         width 64 eq {
  55.                 height 64 eq {
  56.                         xpos 1052 lt {
  57.                                 /xpos xcount def
  58.                                 /ypos ycount def
  59.                                 xpos ypos cwin movewindow
  60.                                 /xcount xcount 64 add def
  61.                                 xcount 1024 ge {
  62.                                         /xcount 0 def
  63.                                         /ycount ycount 64 add def
  64.                                 } if
  65.                         } if
  66.                 } if
  67.         } if
  68. }for
  69.  
  70.  
  71. % The following lines wait for a mouse and restore the icons to the original
  72. %location.  Uncomment them if you don't want the effects to be permanent.
  73.  
  74. %{
  75. %       buttondown {exit} if
  76. %} loop
  77. %0 1 numwins 2 sub  
  78. %{
  79. %       /num exch def
  80. %       /cwin windowlist num get def
  81. %       savecoordinates num get aload pop pop pop cwin movewindow
  82. %}for
  83.